package com.mlh.springboot.controller;

import com.mlh.springboot.exception.AccessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @author 缪林辉
 * @date 2024/3/3 15:39
 * @DESCRIPTION
 */
@Controller
public class MyErrorController {
    @GetMapping(value = {"/err"})
    public String err() {
        int i = 10 / 0;
        return "manage";
    }

    @PostMapping(value = {"/err2"})
    public String err2() {
        return "manage";
    }

    @GetMapping("/err3")
    public String err3(String name){
        if("tom".equals(name)){
            throw new AccessException();
        }
        return "manage";
    }
}
